#version 430 core
in vec4 g2f_FragPos;

uniform vec3 u_LightPos;
uniform float u_FarPlane;

void main()
{
	float LightDistance = length(g2f_FragPos.xyz - u_LightPos);

	// map to [0:1] range by dividing by far_plane
	LightDistance = LightDistance / u_FarPlane;

	// write this as modified depth
	gl_FragDepth = LightDistance;
}